package com.imooc.highter_order_function

object FunctionApp extends App {

  //普通函数
  def sayHello(name:String): Unit ={
    println("Hi: " + name)
  }
  sayHello("PK")

  //匿名函数
  (x:Int) => x + 1

  //匿名函数可以传给变量
  val func = (x:Int) => x + 1
  //匿名函数也可以传给函数
  def add = (x:Int,y:Int) => x+y

  println(func(2))
  println(add(2,2))

}
